.TH std::basic_streambuf::sputc 3 "2024.06.10" "http://cppreference.com" "C++ Standard Libary"
.SH NAME
std::basic_streambuf::sputc \- std::basic_streambuf::sputc

.SH Synopsis
   int_type sputc( char_type ch );

   Writes one character to the output sequence.

   If the output sequence write position is not available (the buffer is full), then
   calls overflow(ch).

.SH Parameters

   ch - character to write

.SH Return value

   The written character, converted to int_type with Traits::to_int_type(ch) on
   success.

   Traits::eof() (as returned by overflow()) on failure.

.SH Example


// Run this code

 #include <iostream>
 #include <sstream>

 int main()
 {
     std::ostringstream s;
     s.rdbuf()->sputc('a');
     std::cout << s.str() << '\\n';
 }

.SH Output:

 a

.SH See also

   sputn invokes xsputn()
         \fI(public member function)\fP
